package com.google.code.opencode.dao.hibernate;

import java.util.List;

import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.transaction.annotation.Transactional;

import com.google.code.opencode.dao.FeedDao;
import com.google.code.opencode.model.Feed;

@Transactional
public class HibernateFeedDao extends HibernateDaoSupport implements FeedDao {

	@Override
	@SuppressWarnings("unchecked")
	public List<Feed> lookup() {
		return getHibernateTemplate().find("from Feed");
	}

	@Override
	public Feed lookup(Integer id) {
		return (Feed) getHibernateTemplate().get(Feed.class, id);
	}

	@Override
	public Feed update(Feed feed) {
		getHibernateTemplate().update(feed);
		return feed;
	}

	@Override
	public Feed create(Feed feed) {
		getHibernateTemplate().persist(feed);
		return feed;
	}

}
